package com.berchen.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ApplicationObjectSupport;
import org.springframework.stereotype.Component;

/**
 * 获取spring IOC容器
 * springContextUtils3.getApplicationContext(); 方法就可以拿到该容器了
 *
 * 底层起始还是用的ApplicationContextAware 方法的 setApplicationContext 方法实现的；
 * ApplicationObjectSupport 实现了 ApplicationContextAware 接口；
 */
@Component
public class SpringContextUtils3 extends ApplicationObjectSupport {

    public ApplicationContext getIoc(){
        return getApplicationContext();
    }

}
